<template>
	<!-- 我的康复顾问 -->
	<view style="		
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;">
		<my-card :title1="adviserName" title2="康复顾问" title3="所属门店" :title4="siteName" title5="../static/logo.png" style="z-index: 100;"></my-card>
		<view style="		
			width: 706rpx;
			height: 601rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 11rpx 14rpx 0rpx #E9F7ED;
			border-radius: 29rpx;
			padding: 38rpx 32rpx;
			display: flex;
			flex-direction: column;
			justify-content: flex-end;
			margin-top: -110rpx;
			box-sizing: border-box;">
			<view style="		
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				padding: 36rpx 80rpx;
				border-bottom: 1rpx solid #E1E1E1;
				margin-bottom: 35rpx;">
				<view v-for="(item,index) in userData" style="			
					display: flex;
					justify-content: center;
					align-items: center;
					flex-direction: column;">
					<view style="			
						height: 56rpx;
						font-size: 48rpx;
						font-family: DINAlternate-Bold, DINAlternate;
						font-weight: bold;
						color: #393939;
						line-height: 56rpx;">{{item.num}}</view>
					<view style="			
						height: 34rpx;
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #393939;
						line-height: 34rpx;">{{item.title}}</view>
				</view>
			</view>
			<my-task :list="list"></my-task>
		</view>
		<view style="		
			width: 750rpx;
			height: 128rpx;
			background: #CBFFDB;
			filter: blur(25px);
			position: absolute;
			z-index: 1;
			top: 0px;"></view>
		<view style="		
			width: 750rpx;
			background: #fff;
			box-shadow: 0rpx 11rpx 14rpx 0rpx #E9F7ED;
			border-radius: 45rpx 45rpx 0rpx 0rpx;
			margin-top: 25rpx;
			box-sizing: border-box;
			padding: 30rpx 30rpx;">
			<view style="			
				height: 42rpx;
				font-size: 31rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: bolder;
				color: #393939;
				line-height: 42rpx;
				margin-bottom: 20rpx;
				margin-left: 8rpx;">我的管理</view>
			<view>
				<view v-for="(item,index) in classData" style="
					justify-content: space-between;			
					display: flex;
					flex-direction: row;
					margin-top: 42rpx;" @click="goto(item)">
					<view style="display: flex;">
						<image :src="item.icon" style="				
							width: 42rpx;
							height: 42rpx;
							margin-right: 13rpx;"></image>
						<view style="				
							font-size: 28rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #393939;">{{item.title}}</view>
					</view>
					<image style="				
						width: 15rpx;
						height: 21rpx;
						margin-right: 20rpx;" src="/static/icon/expend.png"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import myCard from "@/components/my-card.vue"
	import myTask from "@/components/my-task.vue"
	import myClass from "@/components/my-class.vue"
	export default {
		name: "myRehabilitationCounselor",
		components: {
			myCard,
			myTask,
			myClass
		},
		data() {
			return {
				num: 12,
				adviserName: "",
				siteName: "",
				list: [{
					icon: "/static/icon/waitEvaluated.png",
					name: "待评估",
					num: 45
				}, {
					icon: "/static/icon/waitAdvised.png",
					name: "待建议",
					num: 15
				}],
				classData: [{
					icon: "/static/icon/hygl.png",
					title: "会员管理",
					url: "/pages/my/custom-list"
				}, {
					icon: "/static/icon/kfsgl.png",
					title: "康复师管理",
					url: "/pages/my/rehabilitation-list"
				}, {
					icon: "/static/icon/kfjh.png",
					title: "康复计划",
					url: "/pages/my/rehabilitation-plan-list"
				}, {
					icon: "/static/icon/kfpb.png",
					title: "康复排班",
					url: "/pages/my/rehabilitation-class-list"
				}, {
					icon: "/static/icon/yslb.png",
					title: "医生列表",
					url: ""
				}],
				userData: [{
					num: 0,
					title: "会员总数",
				}, {
					num: 0,
					title: "康复中会员",
				}, {
					num: 0,
					title: "康复师",
				}],

			}
		},
		mounted() {
			this.adviserDetail();
			this.adviserCount();
		},
		methods: {
			reLoadFn() {
				//刷新数据逻辑
				this.adviserDetail();
				this.adviserCount();
			},
			adviserDetail() {
				let that = this;
				uni.request({
					url: "https://guokang365.mordo-care.com/api/recureAdviser/find/" + getApp().globalData.recureAdviserId,
					method: 'GET',
					//仅为示例，并非真实接口地址。
					header: {
						'Cookie': "JSESSIONID=" + getApp().globalData.serverSession
					},
					success: (res) => {
						if (res.data.result != '100') {
							// 获取会员详情失败，不确定是否要弹窗
						} else {
							that.siteName = res.data.entity.siteName;
							that.adviserName = res.data.entity.name;
							getApp().globalData.adviserName = res.data.entity.name;
						}
					},
				});
			},
			adviserCount() {
				let that = this;
				uni.request({
					url: "https://guokang365.mordo-care.com/api/custom/countAdviserMemberNumByRecureAdviserId/" + getApp().globalData.recureAdviserId,
					method: 'GET',
					//仅为示例，并非真实接口地址。
					header: {
						'Cookie': "JSESSIONID=" + getApp().globalData.serverSession
						// 'JSESSIONID': getApp().globalData.serverSession //自定义请求头信息
					},
					success: (res) => {
						if (res.data.result != '100') {
							// 获取会员统计数据失败，不确定是否要弹窗
						} else {
							let countData = res.data;
							let list2 = that.userData;
							list2[0].num = countData.totalMemberNum;
							list2[1].num = countData.recuringMemberNum;
							list2[2].num = countData.recureTeacherNum;
							that.userData = list2
						}
					},
				});
			},
			goto(item) {
				uni.navigateTo({
					url: item.url
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		width: 750rpx;
		height: 128rpx;
		background: #CBFFDB;
		filter: blur(25px);
		position: absolute;
		z-index: 1;
		top: 0px;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.task-card {
		width: 706rpx;
		height: 601rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 11rpx 14rpx 0rpx #E9F7ED;
		border-radius: 29rpx;
		padding: 38rpx 32rpx;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		margin-top: -110rpx;
		box-sizing: border-box;
	}

	.class-card {
		width: 750rpx;
		background: #fff;
		box-shadow: 0rpx 11rpx 14rpx 0rpx #E9F7ED;
		border-radius: 45rpx 45rpx 0rpx 0rpx;
		margin-top: 25rpx;
		box-sizing: border-box;
		padding: 30rpx 30rpx;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.class-card {
		.title {
			height: 42rpx;
			font-size: 31rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: bolder;
			color: #393939;
			line-height: 42rpx;
			margin-bottom: 20rpx;
			margin-left: 8rpx;
		}

		.item {
			display: flex;
			flex-direction: row;
			margin-top: 42rpx;

			.icon {
				width: 42rpx;
				height: 42rpx;
				margin-right: 13rpx;
			}

			.title {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #393939;
			}

			.go-icon {
				width: 15rpx;
				height: 21rpx;
				margin-right: 20rpx;
			}
		}
	}

	.info-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 36rpx 80rpx;
		border-bottom: 1rpx solid #E1E1E1;
		margin-bottom: 35rpx;

		.item {
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;
		}

		.title {
			height: 34rpx;
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #393939;
			line-height: 34rpx;
		}

		.num {
			height: 56rpx;
			font-size: 48rpx;
			font-family: DINAlternate-Bold, DINAlternate;
			font-weight: bold;
			color: #393939;
			line-height: 56rpx;
		}
	}
</style>